from distutils.core import setup, Extension

import os

def get_cc_files(folder):
  files = os.listdir(folder);
  cc_files =[];
  for file in files:
    fn, ext = os.path.splitext(file)
    if ext.lower() in ['.cc', '.cpp']:
      cc_files.append("%s/%s"%(folder, file))
  return cc_files
  
src_dir = '../src'
cc_files = get_cc_files(src_dir)

print cc_files

mod = Extension('_pylibMask', 
                    sources= cc_files + ['./mask.i'], 
                    #include_dirs=['../src/'],
                    #library_dirs=['../src/', './'],
                    libraries=['wsock32'],
                    swig_opts = ['-c++'],
                    )

setup (
name = 'pylibMask',
version = '1.0alpha',
description = 'pylibMask based on libMaskV6, support output format of GDSII, CIF',
author = 'Y.Tang',
author_email = 'ytang@ece.ucsb.edu',
ext_modules = [mod],
py_modules = ['pylibMask'],

classifiers = [
        'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
        'Programming Language :: Python',
        'Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)',
        'Topic :: Software Development :: Libraries :: Python Modules'
],
license = 'LGPL-3+',
platforms = 'any'
)

## command
# for windows
# python setup.py build_ext --compiler=mingw32 --inplace
# for linux/cygwin
# python setup.py build_ext --inplace